import rxAjax from '@/assets/js/ajax.js';

//流程授权表 api接口
export const BpmAuthApi = {};

BpmAuthApi.baseUrl= '/api-bpm/bpm/core/bpmAuth';
BpmAuthApi.exportUrl= BpmAuthApi.baseUrl + '/listExport';

//查询列表
BpmAuthApi.query=function (parameter) {
    var url= BpmAuthApi.baseUrl + '/query';
    return rxAjax.postJson(url,parameter).then (res => {
        return res.result
    })
}

/**
 * 获取单记录
 * @param pkId
 * @returns {*}
 */
BpmAuthApi.get =function(pkId) {
    var url= BpmAuthApi.baseUrl + '/get?pkId=' + pkId;
    return rxAjax.get(url);
}

//保存数据
BpmAuthApi.save =function(parameter) {
    var url= BpmAuthApi.baseUrl + '/save';
    return rxAjax.postJson(url,parameter);
}

//添加流程
BpmAuthApi.saveAddProcessArray=function(userId,defIds){
    var url=BpmAuthApi.baseUrl + '/saveAddProcessArray';
    return rxAjax.postJson(url,{userId:userId,defIds:defIds});
}
//添加用户
BpmAuthApi.saveAddUserArray=function(defKey,userIds){
    var url=BpmAuthApi.baseUrl + '/saveAddUserArray';
    return rxAjax.postJson(url,{defKey:defKey,userIds:userIds});
}
//添加角色
BpmAuthApi.saveAddRoleArray=function(defKey,roleIds){
    var url=BpmAuthApi.baseUrl + '/saveAddRoleArray';
    return rxAjax.postJson(url,{defKey:defKey,roleIds:roleIds});
}
//授权超级管理员权限
BpmAuthApi.batchSetSuper=function(authId){
    var url=BpmAuthApi.baseUrl + '/batchSetSuper';
    return rxAjax.get(url,{authId:authId});
}
//授权普通管理员权限
BpmAuthApi.batchSetCommon=function(authId){
    var url=BpmAuthApi.baseUrl + '/batchSetCommon';
    return rxAjax.get(url,{authId:authId});
}

//删除数据
BpmAuthApi.del =function(parameter) {
    var url= BpmAuthApi.baseUrl + '/del';
    return rxAjax.postUrl(url,parameter);
}

BpmAuthApi.delAuth=function(parameter){
    var url= BpmAuthApi.baseUrl + '/delAuth';
    return rxAjax.postUrl(url,parameter);
}

export  default BpmAuthApi;

